<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<style>
		body{
			font-family: cursive;
		}
	</style>
</head>
<body>
	<script>
		var num = prompt("请输入金字塔层数");
		for(var i = 0; i < num; i++){
			for(var a = 0; a < num - i -1; a++){
				document.write("&nbsp;");
			}
			for(var s = 0; s < (i + 1)* 2 -1;s++){
				document.write("*");
			}
			document.write("<br>");
		}

	</script>
</body>
</html>